<script src="<?php echo $this->docroot;?>public/js/highlight.js" type="text/javascript"></script>
<?php
/**
 * Defines the Answers Management
 *
 * @package    Core
 * @author     Saranraj
 * @copyright  (c) 2010 Ndot.in
 */

?>

<form  id="search" name="search" action="<?php echo $this->docroot;?>admin_answers/commonsearch" method="get" class="out_f" enctype="multipart/form-data">
   <table class="ml-20 mt-20 mb-20">
   <tr>
   <td valign="top"><input type= "text" name = "search_value" id = "search_value" size = "40"  class="ml-5"/></td>
   <td class="pl-5"><?php   echo UI::btn_("Submit", "search", "Search Answers", "", "","search","search");?></td>
   </tr>
   <tr>
   <td><span class="quiet">   Ex:Question, Answer, Category..</span></td>
   </tr>
   </table>
</form>

<?php

if(count($this->template->manage_answer)>0)
{
foreach($this->template->manage_answer as $row)
{

?>
       <script>
		                /* for highlighting search */
			        $(function () {
			                $(".runnable")
				                .attr({ title: "Click to run this script" })
				                .css({ cursor: "pointer"})
				                .click(function () {
					                // here be eval!
					                eval($(this).text());
				                });

			                $('div p').highlight('<?php if(isset($_GET["search_value"])) echo $_GET["search_value"];?>'); 			
		                });
			 </script>
 <script>

 $(document).ready(function(){
	 $("#delete_<?php echo $row->question_id;?>").click(function(){ $("#delete_form<?php echo $row->question_id;?>").toggle("show") });
	 $("#close<?php echo $row->question_id;?>").click( function(){  $("#delete_form<?php echo $row->question_id;?>").hide("slow");  });
	 $("#cancel<?php echo $row->question_id;?>").click( function(){  $("#delete_form<?php echo $row->question_id;?>").hide("slow");  });
 });
</script>
	  	<div class="span-14 border_bottom ">
		<div class="span-14" >
        
		<div class="span-2">
		<?php Nauth::getPhoto($row->user_id,$row->name); //get the user photo?>
		</div>

			<div class="span-11">
			<p class="span-11"> <?php echo nl2br(htmlspecialchars_decode($row->question));?> <br></p>

			<div class="v_align fl">
			<ul class="inlinemenu" >
			<li>
			 	<a href="javascript:;" id="delete_<?php echo $row->question_id;?>" title="Delete question">
			 	<img src="<?php echo $this->docroot;?>/public/images/icons/delete.gif" title="Delete" class="admin" />&nbsp;&nbsp;Delete</a> 

			</li>
			<li>
			<?php 
			 if($row->status==0)
			 {
			 ?>
			 <a href="<?php echo $this->docroot;?>admin_answers/answer_access?status=1&id=<?php echo $row->question_id;?>"><img src="<?php echo $this->docroot;?>/public/images/icons/block.gif" title="Block" class="admin" />Block</a>
			 <?php }
			 else
			 {?>
			 <a href="<?php echo $this->docroot;?>admin_answers/answer_access?status=0&id=<?php echo $row->question_id;?>"><img src="<?php echo $this->docroot;?>/public/images/icons/unblock.gif" title="Unblock" class="admin" />Unblock</a>
			<?php } ?>

			</li>
			</ul>
			</div>
	<!-- div for delete answer -->
		<div id="delete_form<?php echo $row->question_id;?>" class="delete_alert" style="clear:both;">
		<h3 class="delete_alert_head">Delete Question</h3>
		<span class="fl">
		<img src="/public/images/icons/delete.gif" alt="delete" id="close<?php echo $row->question_id;?>"  ></span>
		<div >Are you sure want to delete this Question? </div>
		
		<div> 
		<input type="button" name="delete_com" id="delete_com" value="Delete" onclick="window.location='<?php echo $this->docroot;?>admin_answers/delete_answer/?aid=<?php echo $row->question_id;?>&qid=<?php echo $row->id;?>'"  />
		<input type="button" name="cancel" id="cancel<?php echo $row->question_id;?>"  value="Cancel" />
		</div>
		
		</div>
	</div>
</div>

</div>

<?php 
}
}
else
{
        echo UI::nodata_();
}
?>

<?php 
if($this->total >10)
{
?>
<div class="fr">
<?php echo $this->template->pagination;?>
</div>

<?php 
}
?>

